<template>
 <div>
		<group>
<!-- <x&#45;input title="卡片名" v&#45;model="postData.cardType" is&#45;type="china&#45;mobile" :show&#45;clear=true placeholder="卡片名"></x&#45;input> -->
<group title="卡片类型">
      <selector placeholder="卡片类型" title="卡片类型" name="district" :options="list" @on-change="onChange"></selector>
    </group>
<x-input title="卡片名" v-model="postData.cardProductInfo.name"   placeholder="卡片名"></x-input>
<x-input title="面额"  v-model="postData.price" placeholder="面额"></x-input>
<x-input title="发布数量"  v-model="postData.cardProductInfo.quantity" :show-clear=true placeholder="发布数量"></x-input>
<x-input title="卡状态"  v-model="postData.cardProductInfo.state" :show-clear=true placeholder="发布数量"></x-input>
<x-input title="该卡有效期"  v-model="postData.cardProductInfo.expireDate"  :show-clear=true placeholder="默认永久有效"></x-input>
		</group>
<group title="使用说明：">
      <x-textarea :max="20" placeholder="请填写使用说明" @on-focus="onEvent('focus')" @on-blur="onEvent('blur')"></x-textarea>
    </group>
    <wepay-input title="售价" :value="sjj" description="最多可输入金额500元" info="售价" v-model="money">
<x-input
    title="手机号"
    is-type="china-mobile"
    :show-clear=true
    placeholder="请输入手机号"></x-input>
      <x-button @click.native="saveCard" type="primary" slot="button">保存</x-button>
      <x-button type="primary" slot="button">提交发布</x-button>
    </wepay-input>

  </div>
</template>

<script>
import { WepayInput,Group, XButton ,XInput,XTextarea,Selector} from 'vux'
import store from './mystore.js'
import Vue from 'vue'
Vue.component('stoped',{
  template:` <h1>hey there is a stoped</h1> `
})
export default {
  components: {
    WepayInput,
    XButton, XInput,Group, XTextarea,Selector
  },
  data () {
    return {
      money: '',
      list: [{key: 'gd', value: '消费卡'}, {key: 'gx', value: '次卡'}],
      postData: {"cardProductInfo":{"state":"normal","name":"card1","price":"1200","quantity":"3000","expireDate":"360","denomination":"150000","cardType":"normal"} },
     sjj:33
    }
  },
  methods: {
    saveCard (){
{
      console.info("new save",this.postData);
let xx = localStorage.getItem('sessionId')
      this.$http.post('http://192.168.100.106:8881/top/api/merchantCard/addCard',this.postData,{headers: {
        merchantSessionId: xx    }}).then( res => {
      console.info(res,"here we saved card");
      })
    }



       // console.info(741,store.addCard.url);
       // this.$http.post(store.addCard.url,{},this.postData).then( res=> { console.info(res,"adding card save!");})
         },
    onChange(e){
      console.info(e);
    }
  }
}
</script>
